public class ShapeFactory {
    // This array stores all shape names as strings.
    // The shapes menu on the window is built using this array
    private static String[] types = new String[]{"Circle", "Triangle", "Square", "Pentagon"};

    /**
     * Creates a shape object of the specified type
     * 
     * @param type the name of the Shape subclass to create. This string will
     * be one of the strings in the types array
     * @param center_x the x coordinate of the center of the shape we wish to
     * draw
     * @param center_y the y coordinate of the center of the shape we wish to
     * draw
     * @param radius the radius of the "guide" circle that defines the size of
     * our shape
     * @return The shape object we've created as an object of type "Shape"
     */
    public static Shape makeShape(String type, int centerX, int centerY,
            int radius) {
        if (type.equals("Circle")) {
            return new Circle(centerX, centerY, radius);
        }
        if (type.equals("Triangle")) {
            return new Triangle(centerX, centerY, radius);
        }
        if (type.equals("Square")) {
            return new Square(centerX, centerY, radius);
        }
        if (type.equals("Pentagon")) {
            return new Pentagon(centerX, centerY, radius);
        }
        return null;
    }
    
    public static String[] getTypes() {
        return types;
    }
}